package com.scau.ums.util.tools;


import com.scau.ums.model.Maintainer;
import com.scau.ums.model.Student;
import com.scau.ums.model.Teacher;
import com.scau.ums.model.User;

import java.util.LinkedHashMap;
import java.util.Map;

public class UserInfoTool {

      public static Map<String,String> getUserInfo(User user, int userType){
            Map<String,String> map=new LinkedHashMap<>();
            if(userType==User.STUDENT){
                  Student student=(Student)user;
                  map.put("学号",student.getId());
                  map.put("姓名",student.getName());
                  map.put("性别",student.getSex());
                  map.put("专业",student.getMajor());
                  map.put("班级",String.valueOf(student.getClasses()));
                  map.put("电话",student.getTelephone());
                  map.put("宿舍区",student.getDormregion());
                  map.put("宿舍栋",String.valueOf(student.getDormbuilding()));
                  map.put("宿舍号",String.valueOf(student.getDormroom()));
            }else if(userType==User.TEACHER){
                  Teacher teacher=(Teacher)user;
                  map.put("工号",teacher.getId());
                  map.put("姓名",teacher.getName());
                  map.put("性别",teacher.getSex());
                  map.put("电话",teacher.getTelephone());
                  map.put("宿舍区",teacher.getDormregion());
                  map.put("宿舍栋",String.valueOf(teacher.getDormbuilding()));
                  map.put("宿舍号",String.valueOf(teacher.getDormroom()));
            }else if(userType==User.MAINTAINER){
                  //维修工所有信息
                  Maintainer maintainer=(Maintainer)user;
                  map.put("工号",maintainer.getId());
                  map.put("姓名",maintainer.getName());
                  map.put("邮箱",maintainer.getMail());
                  map.put("电话号码",maintainer.getTelephone());
                  if(maintainer.getMaintainergroup()==0){
                        map.put("维修组别","维修主管");
                  }else if(maintainer.getMaintainergroup()==1){
                        map.put("维修组别","电维修组");
                  }else if(maintainer.getMaintainergroup()==2){
                        map.put("维修组别","水维修组");
                  }else if(maintainer.getMaintainergroup()==3){
                        map.put("维修组别","网络维修组");
                  }else if(maintainer.getMaintainergroup()==4){
                        map.put("维修组别","家具维修组");
                  }
            }
            return map;

      }
}
